import 'package:flutter/material.dart';

class MyApp18 extends StatelessWidget {
  const MyApp18({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('GridView初体验'),
        centerTitle: true,
        backgroundColor: const Color.fromARGB(255, 111, 197, 231),
      ),
      body: GridView.builder(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 3,
          mainAxisSpacing: 10,
          crossAxisSpacing: 10,
          childAspectRatio: 1,
        ),
        itemBuilder: (BuildContext context, int index) {
          return Container(
            color: Colors.red,
            alignment: Alignment.center,
            child: Text('传智播客 $index'),
          );
        },
        itemCount: 20,
      ),
    );
  }
}
